// @charset "utf-8";
/**
 * 强弱评级解读画图
 */
define(function (require, exports, module) {

	var qrpjReadChart = {
		$chartDom :	$('#view_div_readchart'),
		qrpjReadOptions : {
			chart: {
				backgroundColor: "rgba(0,0,0,0)",
				type: 'solidgauge',
				style: {
					fontFamily: "simsun",
					fontSize: 12,
					fontWeight: 'normal'
				}

			},
			title: null,
			pane: {
				center: ['50%', '85%'],
				size: '140%',
				startAngle: -90,
				endAngle: 90,
				background: {
					backgroundColor: '#7c7c7c',
					innerRadius: '60%',
					borderWidth: '2px',
					borderColor: '#323232',
					outerRadius: '100%',
					shape: 'arc'
				}
			},

			tooltip: {
				enabled: false
			},

			// the value axis
			yAxis: {
				stops: [
					[0.2, '#2fb56b'],
					[0.4, '#71be40'],
					[0.6, '#f8e43b'],
					[0.8, '#da6a10'],
					[1, '#bf2121']
				],
				lineWidth: 0,
				minorTickInterval: null,
				tickInterval: 20,
				tickWidth: 0,
				title: {
					y: -70
				},
				labels: {
					distance: 8,
					useHTML: true,
					formatter: function() {
						if (this.value == 0) {
							return '<span style="color:#189c53;font-size:12px;">弱</span>';
						} else if (this.value == 20) {
							return '<span style="color:#2fb56b">' + this.value + '</span>';
						} else if (this.value == 40) {
							return '<span style="color:#71be40">' + this.value + '</span>';
						} else if (this.value == 60) {
							return '<span style="color:#e2bb34">' + this.value + '</span>';
						} else if (this.value == 80) {
							return '<span style="color:#da6a10">' + this.value + '</span>';
						} else if (this.value == 100) {
							return '<span style="color:#bf2121;font-size:12px;">强</span>';
						}
					}
				}
			},

			plotOptions: {
				solidgauge: {
					dataLabels: {
						y: 10,
						borderWidth: 0,
						useHTML: true
					}
				},
				series: {
					marker: {
						lineWidth: 10
					},
					pointPadding: 0, //数据点之间的距离值
					groupPadding: 0, //分组之间的距离值
					// borderWidth: 10,
					shadow: false,
					pointWidth: 5 //柱子之间的距离值
				}
			}
		},
		qrpjReadHighcharts : null,
		renderChart : function (newQrpjData) {
			var self = this;
			var data = [];
			data.push(newQrpjData);
			self.$chartDom.highcharts(Highcharts.merge(self.qrpjReadOptions, {
				yAxis: {
					min: 0,
					max: 100,
					title: {
						text: null
					}
				},

				credits: {
					enabled: false
				},

				series: [{
					innerSize: '10%',
					name: 'Speed',
					data: data,
					dataLabels: {
						format: '<div style="text-align:center"><span style="font-size:12px;color:#dedede;font-weight:normal;">涨停个数</span><br/>' +
							'<span style="font-size:12px;color:#dedede;font-weight:normal;">{y}</span></div>'
					},
					lineWidth: 10
				}]

			}));
			this.qrpjReadHighcharts = this.$chartDom.highcharts();
		},
		reflowChart : function () {
			var self = this;
			if (self.qrpjReadHighcharts != null) {
				self.qrpjReadHighcharts.reflow();
			}
		}
	};

	module.exports = qrpjReadChart;
});